<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('/','Home\IndexController@index');


//前台路由分组
Route::group(['prefix'=>'home','namespace'=>'Home'],function(){

<<<<<<< HEAD
	Route::get('/',['middleware'=>['HomeValidation'],'uses'=>'OrderController@orderlist']); //用户中心暨我的订单
	Route::get('cat/{cid}','IndexController@cat'); //品牌页展示
=======
	Route::get('/','IndexController@home'); //用户中心暨我的订单
	Route::get('/buyed','IndexController@buyed'); //用户已购买商品暨历史订单
	Route::get('cat/{cid}/{sort?}','IndexController@cat'); //品牌页展示
>>>>>>> 3937204e34ce650b2b3ea0a8e711cad8760c7d1a
	Route::get('goods/{id}','IndexController@goods'); //商品详情页
	//购物车
	Route::get('cartlist',['middleware'=>['HomeValidation'],'uses'=>'FlowController@cartlist']);//购物车列表
	Route::get('cartadd/{id}/{num}',['middleware'=>['statusCheck','HomeValidation','GoodsExistCheck'],'uses'=>'FlowController@cartadd']);//将商品添加到购物车
	Route::get('cartdel/{id}',['middleware'=>['statusCheck','GoodsExistCheck','CartExistCheck'],'uses'=>'FlowController@cartdel']);//将商品添加到购物车
	Route::get('numdel/{id}',['middleware'=>['statusCheck','GoodsExistCheck','CartExistCheck'],'uses'=>'FlowController@numdel']);//将商品添加到购物车
	Route::get('numadd/{id}',['middleware'=>['statusCheck','GoodsExistCheck','CartExistCheck'],'uses'=>'FlowController@numadd']);//将商品添加到购物车


	//订单
	Route::post('orderadd','OrderController@orderadd');
	Route::post('ordercom','OrderController@ordercom');
	Route::get('orderlist',['middleware'=>['HomeValidation'],'uses'=>'OrderController@orderlist']);
	

	//支付
	Route::post('pay/{id}','OrderController@pay');

	Route::get('sm/{mobile}','IndexController@sm');
	Route::get('checksm','IndexController@checksm');

	//注册
    Route::get('reg','RegController@getReg');
    Route::post('reg','RegController@postReg');
    Route::get('capt','LogController@capt');
    Route::get('login','LogController@getLog');
    Route::post('login','LogController@postLog');
    Route::get('logout','LogController@logout');

});

//后台路由分组
Route::group(['prefix'=>'admins','namespace'=>'Admin','middleware'=>['adminValidation','rule']],function(){
	//栏目增删改查
	Route::get('cadd','CatController@cadd');
	Route::post('cadd','CatController@caddpost');
	Route::get('clist','CatController@clist');
	Route::get('cdel/{cid}','CatController@cdel');
	Route::get('cedit/{cid?}','CatController@cedit');
	Route::post('cedit/{cid}','CatController@ceditpost');

	Route::get('wxj','CatController@wxj');
	Route::get('tree','CatController@getTree');
	Route::get('index','GoodsController@index');
	//商品增删改查
	Route::get('gadd','GoodsController@gadd');
	Route::post('gadd','GoodsController@gaddpost');
	Route::get('glist/{cat_id?}','GoodsController@glist');
	Route::get('gdel/{gid}','GoodsController@gdel');
	Route::get('gedit/{gid}','GoodsController@gedit');
	Route::post('gedit','GoodsController@geditpost');
	//ajax上传图片接收路由:
	Route::post('img','GoodsController@getImg');
	//ajax修改best字段
	Route::get('best/{id}/{ok}','GoodsController@best');
	//ajax修改HOT字段
	Route::get('hot/{id}/{ok}','GoodsController@hot');
	//ajax上下架操作
	Route::get('sale/{id}/{ok}','GoodsController@sale');
	/**
	*########################权限管理系列########################
	*/
	//添加角色
	Route::get('roleadd','PrivilegeController@roleadd');
	Route::post('roleadd','PrivilegeController@roleaddPost');
	Route::get('rolelist','PrivilegeController@rolelist');
	Route::get('adminlist','UserController@adminlist');

    //后台登陆
    Route::get('reg','UserController@getRegister');
    Route::post('reg','UserController@postRegister');

    //后台登陆
    Route::get('login','LogController@getLogin');

	Route::post('login','LogController@postLogin');
	//商品回收站
	//还原商品操作
	Route::get('hy/{gid}','GoodsController@hy');
	//进入回收站
	Route::get('grealdel/{cat_id?}','GoodsController@goodsdel');
	//删除商品
	Route::get('grealdelpass/{gid}','GoodsController@goodsdelpost');

	
	Route::get('orderinfo/{oid?}','OrderController@orderinfo');
	Route::get('orderlist','OrderController@orderlist');

	

});

###############################后台登录##########################
    Route::get('admins/login','Admin\UserController@getLogin');
    Route::post('admins/login','Admin\UserController@postLogin');


    Route::get('admins/logout','Admin\UserController@getLogout');

//自带用户路由分组
Route::group(['prefix'=>'auth','namespace'=>'Auth'],function(){

	

});



//测试生成缩略图路由
Route::get('thumb',function(){
	return view('thumb');
});
Route::post('thumb','Admin\GoodsController@thumb');

//图片空间路由组
Route::group(['prefix'=>'img','namespace'=>'Admin'],function(){
	//上传图片入口
	Route::get('up','ImgController@upload');
	Route::post('up','ImgController@uploadpost');
	//图片空间
	Route::get('list/{gid?}','ImgController@imglist');
	//Ajax 修改图片
	Route::post('list','ImgController@imgupdate');
	//删除图片
	Route::get('del/{img_id}','ImgController@imgdel');
});

//订单管理路由组
Route::group(['prefix'=>'order','namespace'=>'Admin'],function(){
	//默认显示已付款未发货订单
	Route::get('ys','OrderController@yishou');//已付款未发货
	Route::get('wf','OrderController@weifu');//未付款
	Route::get('yf','OrderController@yifa');//已发货
	Route::get('end','OrderController@end');//已完成订单
	Route::get('del/{oid}','OrderController@del');
	//Ajax发货操作
	Route::post('fahuo','OrderController@fahuo');
	//订单详情
	Route::get('info/{oid}','OrderController@info');
});
